package com.dreamers.utility;

import com.dreamers.core.MonoBehaviour;

public class Singleton<T> extends MonoBehaviour {
    public ThreadLocal<T> instance = new ThreadLocal<T>();

    public T Instance() {
        return instance.get();
    }


    public void Awake() {

        if (instance.get() != null)
            instance = null;
        else
            instance.set((T) this);
    }


}
